import book.Booklist;
import user.Admin;
import user.Regularuser;
import user.User;

import java.util.Scanner;

public class test {
    public static User login() {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入你的姓名");
        String username = sc.nextLine();
        System.out.println("请选择你的身份1.管理员  2.普通用户");
        int userType = sc.nextInt();

        if(userType == 2) {
            return new Regularuser(username);
        }
        else {
            return new Admin(username);
        }
    }
    public static void main(String[] args) {
        Booklist booklist = new Booklist();
        User user = login();

        while(true) {
            int choice = user.menu();

            user.doIA(choice, booklist);
        }
    }
}
